Delete object[i] from table or group in corona sdk

Posted by Rober Dote on Stack Overflow See other posts from Stack Overflow or by Rober Dote
Published on 2012-06-20T22:24:42Z Indexed on 2012/06/21 9:16 UTC
Read the original article Hit count: 207

Filed under:
|
|

i have a problem (obviusly :P)

i'm create a mini game, and when i touch a Object-A , creates an Object-B. If i touch N times, this create N Object-B.

(Object-B are Bubbles in my game)

so, i try when I touch the bubble (object-B), that disappears or perform any actions. I try adding Object-B to Array

local t = {}

. . .

bur = display.newImage("burbuja.png")
table.insert(t,bur)

and where i have my eventListeners i wrote:

for i=1, #t do
bur[i]:addEventListener("tap",reventar(i))
end

and my function 'reventar'

local function reventar (event,id)
table.remove(t,id)
end

i'm lost, and only i want disappears the bubbles.

© Stack Overflow or respective owner

Related posts about SDK

Related posts about lua